#!/usr/bin/python
# coding=utf-8

import plotly.plotly
import plotly.figure_factory as fff
import numpy as np


class Distplots:
    # 分析数据分布情况的表格
    def ___init__(self):
        print "数据分布图标生成!"

    def makeDistplot(self, data, group):
        fig = fff.create_distplot(data, group)
        plotly.offline.plot(fig, filename="dist.html")
        # 多组数据处理办法
        # hist_data = [x1, x2, x3, x4]
        # group_labels = ['Group 1', 'Group 2', 'Group 3', 'Group 4']
        # fig = ff.create_distplot(hist_data, group_labels, bin_size=.2)

if __name__ == "__main__":
    # xy = np.random.randn(200) * 10 +10
    xy = [39.43373161402263,58.74750323111268,121.93634922570418,119.52607909638284,119.82706557895645,80.59623302161994,66.29630932504945,121.55029808311382,113.95786935363378,119.68436838369851]
    data1 = [xy]
    group1 = ["test1"]
    drive = Distplots()
    drive.makeDistplot(data1, group1)
